#ifndef CUSTOM_WARNING_H
#define CUSTOM_WARNING_H

#include <QWidget>
#include <QMouseEvent>
#include <QPainter>
#include <QDebug>
#include <QDialog>

namespace Ui {
class Custom_warning;
}

class Custom_warning : public QDialog
{
    Q_OBJECT

public:
    enum PUSHBUTTON_NAME{
        OK,
        NO,
        YES,
    };

    explicit Custom_warning(QString text, Custom_warning::PUSHBUTTON_NAME _type, QWidget *parent = nullptr);
    ~Custom_warning();

    static int Display(QString text, Custom_warning::PUSHBUTTON_NAME type,QWidget *parent = nullptr);
    void Ui_Init();



    QString label_text;
    PUSHBUTTON_NAME type;
    int ret_type = NO;


/*--------------无边框全部参数---------------------*/
private slots:
    void on_pushButton_close_clicked();

    void on_pushButton_clicked();

private:
    int MARGIN = 0;     //可以修改大小的距离
    bool _isleftpressed = false; //判断是否是左键点击
    int _curpos = 0;    //鼠标左键按下时光标所在区域
    QPoint _plast;      //获取鼠标左键按下时光标在全局(屏幕而非窗口)的位置


    int countRow(QPoint p);
    int countFlag(QPoint p, int row);
    void setCursorType(int flag);
    void System_Prompt();
    void paintEvent(QPaintEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void Maximization_And_Recovery();
private:
    Ui::Custom_warning *ui;
};

#endif // CUSTOM_WARNING_H
